package main;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;

public class RunningMegazord {

	public static void main(String[] args) {
	
		
		  ThePlace onePlace = new ThePlace();
	      ThePlaceLRU onePlaceLRU = new ThePlaceLRU();
	      ThePlaceWSClock onePlaceWSClock = new ThePlaceWSClock();
	      ThePlaceRandom onePlaceRandom = new ThePlaceRandom();
	      
	    try {
			Eraser(new File("pageFaultLog.txt"));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			Eraser(new File("log.txt"));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			Eraser(new File("readLog.txt"));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			Eraser(new File("writeLog.txt"));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	      
		  //onePlace.populate();
	      
	      //Process p1 = new Process(onePlace, 1);
	      //Process p2 = new Process(onePlace, 2);
	      //Process p3 = new Process(onePlace, 3);
	      //Process p4 = new Process(onePlace, 4);
	      //Process p5 = new Process(onePlace, 5);
	      
	      
		  //onePlaceLRU.populate();
	      
	      //Process p1 = new Process(onePlaceLRU, 1);
	      //Process p2 = new Process(onePlaceLRU, 2);
	      //Process p3 = new Process(onePlaceLRU, 3);
	      //Process p4 = new Process(onePlaceLRU, 4);
	      //Process p5 = new Process(onePlaceLRU, 5);
		
		  //onePlaceWSClock.populate();
	      
	      //Process p1 = new Process(onePlaceWSClock, 1);
	      //Process p2 = new Process(onePlaceWSClock, 2);
	      //Process p3 = new Process(onePlaceWSClock, 3);
	      //Process p4 = new Process(onePlaceWSClock, 4);
	      //Process p5 = new Process(onePlaceWSClock, 5);
	       
		  onePlaceRandom.populate();
		
	      Process p1 = new Process(onePlaceRandom, 1);
	      Process p2 = new Process(onePlaceRandom, 2);
	      Process p3 = new Process(onePlaceRandom, 3);
	      Process p4 = new Process(onePlaceRandom, 4);
	      Process p5 = new Process(onePlaceRandom, 5);
	       
	    
	      p1.start();
	      p2.start();
	      p3.start();
	      p4.start();
	      p5.start();
	      
	   }
	
	public static void Eraser(File file) throws FileNotFoundException{
		
		PrintWriter writer = new PrintWriter(file);
		writer.print("");
		writer.close();
		
	}
}
